package com.caopeng.achievementmanagement.service;

import com.caopeng.achievementmanagement.mapper.AchievementMapper;
import com.caopeng.achievementmanagement.pojo.Achievement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Crescent_P
 * @date 2021-12-05 11:08
 */
@Service
public class AchievementServiceImpl implements AchievementService {

    @Autowired
    private AchievementMapper achievementMapper;

    @Override
    public List<Achievement> getAllAchievements() {
        return achievementMapper.getAllAchievements();
    }

    @Override
    public List<Achievement> getAchievementsByUserID(long id) {
        return achievementMapper.getAchievementsByUserID(id);
    }

    @Override
    public int deleteAchievement(long id) {
        return achievementMapper.deleteAchievement(id);
    }

    @Override
    public int uploadAchievement(Achievement achievement) {
        return achievementMapper.uploadAchievement(achievement);
    }

    @Override
    public Achievement getAchievementById(long id) {
        return achievementMapper.selectAchievementById(id);
    }

    @Override
    public int updateAchievement(Achievement achievement) {
        return achievementMapper.updateAchievement(achievement);
    }

    @Override
    public List<Achievement> searchByTitle(String title) {
        return achievementMapper.searchByTitle(title);
    }

    @Override
    public List<Achievement> searchByTitleAndUser(long uid, String title) {
        return achievementMapper.searchByTitleAndUserId(uid,title);
    }
}
